\section{user\_\-handler::music\_\-handler Class Reference}
\label{classuser__handler_1_1music__handler}\index{user_handler::music_handler@{user\_\-handler::music\_\-handler}}
This class handles all messages from music\_\-clients.  


{\tt \#include $<$music\_\-handler.h$>$}

Inheritance diagram for user\_\-handler::music\_\-handler::\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3cm]{classuser__handler_1_1music__handler}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
\bf{music\_\-handler} (boost::shared\_\-ptr$<$ \bf{network::i\_\-socket} $>$ s, boost::shared\_\-ptr$<$ \bf{music::music\_\-system} $>$ m)
\begin{CompactList}\small\item\em \doxyref{music\_\-handler}{p.}{classuser__handler_1_1music__handler} creates a new music-handler. Don't use this constructor directly, use the create method instead. \item\end{CompactList}\item 
virtual \bf{$\sim$music\_\-handler} ()\label{classuser__handler_1_1music__handler_c91f8064f2b387f08fa5e32903402dc5}

\item 
virtual void \bf{handle\_\-event} (boost::shared\_\-ptr$<$ \bf{network::message} $>$ n)
\begin{CompactList}\small\item\em handle\_\-event handles the music-events \item\end{CompactList}\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static boost::shared\_\-ptr$<$ \bf{user\_\-handler::music\_\-handler} $>$ \bf{create} (boost::shared\_\-ptr$<$ \bf{network::i\_\-socket} $>$ sock, boost::shared\_\-ptr$<$ \bf{music::music\_\-system} $>$ m)
\begin{CompactList}\small\item\em create creates a new \doxyref{music\_\-handler}{p.}{classuser__handler_1_1music__handler} \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
This class handles all messages from music\_\-clients. 



Definition at line 40 of file music\_\-handler.h.

\subsection{Constructor \& Destructor Documentation}
\index{user_handler::music_handler@{user\_\-handler::music\_\-handler}!music_handler@{music\_\-handler}}
\index{music_handler@{music\_\-handler}!user_handler::music_handler@{user\_\-handler::music\_\-handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}user\_\-handler::music\_\-handler::music\_\-handler (boost::shared\_\-ptr$<$ \bf{network::i\_\-socket} $>$ {\em s}, boost::shared\_\-ptr$<$ \bf{music::music\_\-system} $>$ {\em m})\hspace{0.3cm}{\tt  [inline]}}\label{classuser__handler_1_1music__handler_41873109bdd7f3d7a8eeebd2d052db4b}


\doxyref{music\_\-handler}{p.}{classuser__handler_1_1music__handler} creates a new music-handler. Don't use this constructor directly, use the create method instead. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em s}]is the socket to the music-client. \item[{\em m}]is a pointer to the music-system. \end{description}
\end{Desc}


Definition at line 49 of file music\_\-handler.h.

\begin{Code}\begin{verbatim}51                 : _sock(s), _music(m) {}
\end{verbatim}\end{Code}




\subsection{Member Function Documentation}
\index{user_handler::music_handler@{user\_\-handler::music\_\-handler}!create@{create}}
\index{create@{create}!user_handler::music_handler@{user\_\-handler::music\_\-handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static boost::shared\_\-ptr$<$\bf{user\_\-handler::music\_\-handler}$>$ user\_\-handler::music\_\-handler::create (boost::shared\_\-ptr$<$ \bf{network::i\_\-socket} $>$ {\em sock}, boost::shared\_\-ptr$<$ \bf{music::music\_\-system} $>$ {\em m})\hspace{0.3cm}{\tt  [inline, static]}}\label{classuser__handler_1_1music__handler_8aaa492a53bc1226f6e39e701ed24ba3}


create creates a new \doxyref{music\_\-handler}{p.}{classuser__handler_1_1music__handler} 

\begin{Desc}
\item[See also:]\doxyref{music\_\-handler}{p.}{classuser__handler_1_1music__handler} \end{Desc}


Definition at line 66 of file music\_\-handler.h.

\begin{Code}\begin{verbatim}69                 {
70                         boost::shared_ptr<user_handler::music_handler> ptr(
71                                 new user_handler::music_handler(sock, m));
72                         ptr->_this = ptr;
73                         return ptr;
74                 }
\end{verbatim}\end{Code}


\index{user_handler::music_handler@{user\_\-handler::music\_\-handler}!handle_event@{handle\_\-event}}
\index{handle_event@{handle\_\-event}!user_handler::music_handler@{user\_\-handler::music\_\-handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void user\_\-handler::music\_\-handler::handle\_\-event (boost::shared\_\-ptr$<$ \bf{network::message} $>$ {\em n})\hspace{0.3cm}{\tt  [virtual]}}\label{classuser__handler_1_1music__handler_950443763803145c8939833db4d35042}


handle\_\-event handles the music-events 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em n}]is a pointer to the received message. \end{description}
\end{Desc}


Implements \bf{handler::event\_\-handler} \doxyref{p.}{classhandler_1_1event__handler_7ff75131a32fb17cf4addc4581344bff}.

Definition at line 10 of file music\_\-handler.cpp.

\begin{Code}\begin{verbatim}12 {
13         if(e->type == network::RECEIVE) {
14                 boost::shared_ptr<model::dom> node(e->node);
15                 if(node->name() != "client") {
16                         return;
17                 }
18                 cout << node->to_string() << endl;
19                 _music->add_music(node, _sock);
20         } else if(e->type == network::DELETE) {
21                 cout << "deleting a client..." << endl;
22                 _music->remove_music(_sock);
23                 boost::shared_ptr<user_handler::music_handler> ptr(_this.lock());
24                 fire_listener();
25                 _this.reset();
26         }
27 }
\end{verbatim}\end{Code}




The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
user\_\-handler/music\_\-handler.h\item 
user\_\-handler/music\_\-handler.cpp\end{CompactItemize}
